<?php

class Dcmp_Component_Result_Template extends Dcmp_Component_Result_Base {
	
	private $_path = '';
	
	public function getPath(){
		return $this->_path;
	}
	
	public function setPath($value){
		$this->_path = $value;
		return $this;
	}

    public function execute() {
    	$tmpl = new Dcmp_Template($this->getComponent()->getDomain());
    	$tmpl->assignMulti($this->getAllData());
    	$tmplPath = $this->getPath();
    	if(!file_exists($tmplPath)){
    		$tmplPath = Kd_Util_IO::findFile($this->getComponent()->getDomain()->getConfig()->getSetting('templateDirectories'), $tmplPath);
    	}
    	Kd_Web::getResponse()->write($tmpl->render($tmplPath));
    }
}